package com.example.doudou.demos.config;

import org.springframework.boot.task.TaskExecutorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author fangtao
 * @projectName doudou
 * @date 2025/5/30
 * @description
 */
@Configuration
@EnableAsync
public class ThreadConfig {

    @Bean(name = "getDataHandleExecutor")
    ThreadPoolTaskExecutor getDataHandleExecutor(TaskExecutorBuilder builder) {
        ThreadPoolTaskExecutor taskExecutor = builder.build();
        taskExecutor.setThreadNamePrefix("interface-handle-thread-");
        return taskExecutor;
    }

}